package korwin;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.imageio.ImageIO;

public class Rurkowiec extends Enemy {

    Rurkowiec() {
        try {
	        // Load images for enemy rurkowiec
	        URL bodyImgUrl = this.getClass().getResource("/korwin/resources/images/2_helicopter_body.png");
	        bodyImg = ImageIO.read(bodyImgUrl);
	        URL frontAnimImgUrl = this.getClass().getResource("/korwin/resources/images/2_front_propeller_anim.png");
	        frontAnimImg = ImageIO.read(frontAnimImgUrl);
        }
        catch (IOException ex) 
        {
            Logger.getLogger(Game.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    	movingXspeed = -4;
    }
    
    
    public void Initialize(int xCoordinate, int yCoordinate)
    {
    	health = 2;

        this.offsetXFrontAnim = -35;
        this.offsetYFrontAnim = -30;
        
        // Initialize animation object
        this.frontAnim = new Animation(frontAnimImg, 79, 100, 8, 40, true, (int) (this.xCoordinate + this.offsetXFrontAnim), (int) (this.yCoordinate + this.offsetYFrontAnim), 0);
        this.rearAnim = new Animation(rearAnimImg, 47, 47, 10, 10, true, (int) (this.xCoordinate + this.offsetXRearAnim), (int) (this.yCoordinate + this.offsetYRearAnim), 0);
       
    	
        // Sets enemy position.
        this.xCoordinate = xCoordinate;
        this.yCoordinate = yCoordinate;
    }
    
    /**
     * It sets speed and time between enemies to the initial properties.
     */
//    public static void restartEnemy() {
//        Rurkowiec.timeBetweenNewEnemies = timeBetweenNewEnemiesInit;
//        Rurkowiec.timeOfLastCreatedEnemy = 0;
//    }
    
    
    /**
     * It increase enemy speed and decrease time between new enemies.
     */
//    public static void speedUp(){
//        if(Rurkowiec.timeBetweenNewEnemies > Framework.secInNanosec)
//            Rurkowiec.timeBetweenNewEnemies -= Framework.secInNanosec / 100;
//        
//        Rurkowiec.movingXspeed -= 0.25;
//    } 
    
    /**
//     * Draws enemy to the screen.
//     * 
//     * @param g2d Graphics2D
//     */
//    public void Draw(Graphics2D g2d)
//    { 
//        g2d.drawImage(helicopterBodyImg, xCoordinate, yCoordinate, null);
//        helicopterFrontPropellerAnim.Draw(g2d);
//        //helicopterRearPropellerAnim.Draw(g2d);
//    }
    
}
